import json


def save_dom(page_content: str = None, page_evaluate: str = None, output_prefix="page"):
    # 保存为 JSON 文件（结构化，AI 易读）
    with open(f"{output_prefix}.json", "w", encoding="utf-8") as f:
        json.dump(page_evaluate, f, ensure_ascii=False, indent=2)
    print(f"✅ JSON 已保存到: {output_prefix}.json")

    with open(f"{output_prefix}.html", "w", encoding="utf-8") as f:
        f.write(page_content)
    print(f"✅ HTML 已保存到: {output_prefix}.html")

